package com.chapter11.enum_;

/**
 * @author 宋鑫宇
 * @version 1.0
 * 使用enum关键字的枚举类
 */
public class Enumeration02 {
    public static void main(String[] args) {
        System.out.println(Season02.SPRING);

    }
}
//演示使用关键字enum实现枚举类
//用enum修饰的类 系统默认添加final修饰
enum Season02 {

//    public final static Season SPRING = new Season("春天","温暖");
//    public final static Season WINTER = new Season("冬天","寒冷");
//    public final static Season AUTUMN = new Season("秋天","凉爽");
//    public final static Season SUMMER = new Season("夏天","炎热");
    //如果使用了enum 来实现枚举类 用如下写法
    //1.使用关键字enum替代class
    //2. public final static Season SPRING = new Season("春天","温暖");直接使用
    //      SPRING("春天","温暖");就可以替代
    //3.如果有多个常量（对象）则使用,间隔最后用分号结尾
    //4.如果用枚举enum关键字要求将常量对象定义在类的最前面 **语法规定
    SPRING("春天","温暖"),
    WINTER("冬天","寒冷"),
    AUTUMN("秋天","凉爽"),
    SUMMER("夏天","炎热"),
    ABC;

    private String name;
    private String desc;
    private Season02(){}
    private Season02(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return "Season{" +
                "name='" + name + '\'' +
                ", desc='" + desc + '\'' +
                '}';
    }
}
